<template>
	<view class="">
		<view class="q1">
			<span class='q2'>类别名称</span>
			<input class="q3" type="text" v-model="shuju" :value="shuju" style="text-align: right;">
		</view>
		
		<view class="q1">
			<span class='q2'>排序</span>
			<input class="q3" type="text"  v-model="bianhao" :value="bianhao" style="text-align: right;">
		</view>
		
		<button @click="amend" class="ww">保存</button>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				shuju:'',
				bianhao:'',
				shujuq:'',
				bianhaoq:'',
				
			
			}
		},
		
		onLoad: function (option) { //option为object类型，会序列化上个页面传递的参数
			console.log(option.id); //打印出上个页面传递的参数。
			this.bianhao=option.id,
			this.bianhaoq=option.id,
			console.log(option.title); //打印出上个页面传递的参数。
			this.shuju=option.title
			this.shujuq=option.title
		},
		methods:{
			amend(){
				console.log(this.shuju);
				console.log(this.bianhao);
				// console.log();
				if(this.shuju==this.shujuq&&this.bianhao==this.bianhaoq){
					alert("请修改")
				}else{
					uni.request({
							
							url:'http://localhost:3000/amend',
							data:{
								qw:this.shuju,
								qe:this.bianhao,
								qr:this.bianhaoq,
								qt:this.shujuq
							}
						}).then((res) => {
						  console.log("请求结果是....");
						  console.log(res.data);
						
						}),
						uni.navigateTo({
							url: '/pages/Classification/allclassify'
						});
				}
				
			}
			
		}
	}
</script>

<style>
	.q1{
		display: flex;
		width: 90%;
		font-size: 16px;
	
		margin: 0 auto;
		border-bottom: 1px solid rgba(0, 0, 0, 0.1);
	}
	.q2{
		margin-top: 30px;
		flex: 3;
		margin-left: 10px;
	}
	.q3{
		margin-top: 30px;
		flex: 7;
		margin-right: 10px;
		margin-bottom: 5px;
	}
	.ww{
		width: 90%;
		margin: 0 auto;
		color: black;
		font-weight: bolder;
		background-color: #fccc04;
		margin-top: 50px;
	}
</style>